require 'erb'
require 'common/base'

class TACACSBase < Base

  attr_accessor :step, :transport, :base_hosts, :base_options, :base_transports, :base_variables, :message, :user, :password

  def initialize(step, filename, params = {}, transport="Tacacs")
    super()
    @transport = transport
    @step = step
    
    @user = params["user"] or ""
    @password = params["password"] or ""

   @base_hosts ='&host_0 = host(role: "client", description: "client/src", type: v4)
        &host_1 = host(role: "server", description: "server/dst", type: v4)
   '

    @base_options = "
     $user='<%= @user %>'
     $password='<%= @password %>'"

    @base_variables = ''

    @base_transports = 'Tacacs = tcp(src: &host_0, dst: &host_1, dst_port: 49)'

    if !filename.nil?
      template = get_message("TACACS", filename)
      erb = ERB.new(template, 0, '%<>')
      @message = erb.result(binding)
    end
  end
  
end
